//package me.zhengjie;
//
//import me.zhengjie.modules.GlobalInterceptor;
//import me.zhengjie.modules.wrap.BodyWrapperFilter;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class MvcConfig implements WebMvcConfigurer {
//
//    @Bean
//    public HandlerInterceptor handlerInterceptor() {
//        return new GlobalInterceptor();
//    }
//
//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        InterceptorRegistration interceptor = registry.addInterceptor(handlerInterceptor());
//        //配置拦截路径，不配置默认为 **，拦截所有
//        interceptor
////        .addPathPatterns("/fht/**")
////                //不拦截路径
//                .excludePathPatterns("/api/localStorage/pictures");
//    }
//
//    @Bean
//    BodyWrapperFilter getBodyWrapperFilter() {
//        return new BodyWrapperFilter();
//    }
//
//    @Bean("bodyWrapperFilter")
//    public FilterRegistrationBean<BodyWrapperFilter> checkUserFilter(BodyWrapperFilter bodyWrapperFilter) {
//        FilterRegistrationBean<BodyWrapperFilter> registrationBean = new FilterRegistrationBean();
//        registrationBean.setFilter(bodyWrapperFilter);
//        registrationBean.addUrlPatterns("/*");
//        registrationBean.setOrder(1);
//        registrationBean.setAsyncSupported(true);
//        return registrationBean;
//    }
//}
